const BehaviorAll = require("../../../behaviors/behavior_all.js");
const ServiceService = require("../../../service/service_service.js");

Component({
  /**
   * behaviors
   */
  behaviors: [BehaviorAll],

  /**
   * 页面的初始数据
   */
  data: {
	service: null
  },

  methods: {
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
      const _this = this;
      ServiceService.get(function(data){
        _this.setData({
          service: data
        })
      })
    },
    /**
     * 拨打电话
     */
    onCall: function(e){
      wx.makePhoneCall({
        phoneNumber: '400 859 2759', 
        success: function () {
          console.log("拨打电话成功！")
        },
        fail: function () {
          console.log("拨打电话失败！")
        }
      })
    },
    /**
     * 在线客服
     *  文档：https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/customer-message/customer-message.html
     *  教程：https://blog.csdn.net/weixin_45767954/article/details/102785462
     */
    handleContact: function(e) {
      console.log(e.detail.path)
      console.log(e.detail.query)
    }

  }

})